local sz_qiaoshi = fk.CreateSkill {
    name = "sz_qiaoshi",
    anim_type = "offensive",
}
Fk:loadTranslationTable {
    ["sz_qiaoshi"] = "樵拾",
    [":sz_qiaoshi"] = "准备阶段，你可以选择一名手牌数与你不同的其他角色，手牌较少者将手牌摸至对方相等，若因此获得了伤害牌，你可以使用其中一张，此牌无次数和距离限制(至多摸体力上限相等的牌)。",

    ["$sz_qiaoshi1"] = "樵烟亮亮升，待君归来时",
    ["$sz_qiaoshi2"] = "青翠枝繁茂，采拾心欢喜",
}
sz_qiaoshi:addEffect(fk.EventPhaseStart, {
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(sz_qiaoshi.name) and player.phase == Player.Start and
            table.find(player.room.alive_players, function(p) return p:getHandcardNum() ~= player:getHandcardNum() end)
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local ids = {}
        for _, i in ipairs(room:getOtherPlayers(player)) do
            if i:getHandcardNum() ~= player:getHandcardNum() then
                table.insertIfNeed(ids, i)
            end
        end
        local tos = room:askToChoosePlayers(player, {
            targets = ids,
            min_num = 1,
            max_num = 1,
            prompt = "樵拾：你可以选择一名角色，手牌少的摸牌，摸到伤害牌可以用。",
            skill_name = sz_qiaoshi.name,
            cancelable = true
        })
        if #tos > 0 then
            event:setCostData(self, { tos = tos })
            return true
        end
        return false
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local to = event:getCostData(self).tos[1]
        local x = math.abs(player:getHandcardNum() - to:getHandcardNum())
        local cards
        local user
        if player:getHandcardNum() > to:getHandcardNum() then
            cards = to:drawCards(math.min(to.maxHp, x), sz_qiaoshi.name)
            user = to
        else
            cards = player:drawCards(math.min(player.maxHp, x), sz_qiaoshi.name)
            user = player
        end
        local ids = {}
        for _, i in ipairs(cards) do
            if Fk:getCardById(i).is_damage_card then
                table.insertIfNeed(ids, i)
            end
        end
        if #ids > 0 then
            room:askToUseRealCard(user, {
                pattern = ids,
                skill_name = sz_qiaoshi.name,
                prompt = "樵拾：你可以使用其中一张牌。",
                extra_data = {
                    bypass_times = true,
                    bypass_distances = true,
                    extraUse = true,
                }
            })
        end
    end
})
return sz_qiaoshi
